<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">

<f:view contentType="text/html" encoding="UTF-8">
	<h:head>	
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<f:facet name="main">
			<title>Sistema de Gerenciamento de Aceleração da Aprendizagem</title>
		</f:facet>
		<link type="text/css" rel="stylesheet" href="#{request.contextPath}/css/default.css" />
		<link type="text/css" rel="stylesheet"
			href="#{request.contextPath}/css/syntaxhighlighter/syntaxhighlighter.css" />
		<link rel="shortcut icon" type="image/png"
			href="#{request.contextPath}/imagens/favicon.png" />

		<script type="text/javascript">
		 function erro() {
			 window.location = '/SiGAA/error.xhtml';
			 };
			function verificaSessao() {		
				alert ('#{facesContext.externalContext.getSession(false) == null}');
				
				if ('#{facesContext.externalContext.getSession(false) == null}'==true) {
					alert ("wat");
					 window.location = '/SiGAA/expired.xhtml';
					 alert ("wut");
				}
			};
			 
		
		</script>



		<style type="text/css">
.ui-widget {
	font-size: 100% !important;
}

.ui-widget .ui-widget {
	font-size: 100% !important;
}

.ui-layout-north {
	z-index: 10 !important;
	overflow: visible !important;;
}

.ui-layout-north .ui-layout-unit-content {
	overflow: visible !important;
}

.ui-growl {
	position: fixed !important;
	top: 0% !important;
	left: 50% !important;
	width: 360px !important;
	height: 110px !important;
	z-index: 9999 !important;
}

.botao {
	border-width: 1px !important;
	border-color: #000000 !important;
	border-style: solid !important;
	text-align: center !important;
	font-weight: bold !important;	
	font-size: x-small !important;	
	background: #FFFFFF !important;	
	color: #000000 !important;
	width: 200px !important;
	height: 30px !important;
}

.boj {
	border-width: 0px !important;
	text-align: center !important;
	font-weight: bold !important;	
	font-size: x-small !important;	
	width: 100% !important;
	background: #FFFFFF ;	
	
}


.ui-logado {
	background-image: url('./imagens/user.png') !important;
}

.ui-sigaa {
	background-image: url('./imagens/sigaa_small.jpg') !important;
}
</style>


	</h:head>


	<h:body>
		<p:layout fullPage="true" id="fl">

			<p:layoutUnit id="top" position="north" size="50">
				<h:form id="barra">
					<p:menubar autoSubmenuDisplay="true">
						<p:submenu label="#{sessao.usuario.login}" icon="ui-logado">
							<p:menuitem value="Editar dados"
								actionListener="#{controladora.editUsuario}"
								update=":formC:pnlCorpo"
								rendered="#{sessao.usuario.categoria!=0}">
								<f:actionListener binding="#{actionPerfil.popularUser}" />
							</p:menuitem>
							<p:menuitem value="Sair" action="#{loginBean.sair}">

							</p:menuitem>
						</p:submenu>
						<p:submenu label="#{sessao.usuario.empresa.nome}"
							icon="ui-icon-home" rendered="#{sessao.usuario.categoria==0}">

							<p:menuitem>
								<ui:repeat var="empresa" value="#{actionEmpresa.listaEmpresa}">
									<p:commandButton value="#{empresa.nome}" styleClass="boj"
										action="#{actionEmpresa.selecionarEmpresaId(empresa.id)}"
										update=":formC:growl,:barra" />

								</ui:repeat>
							</p:menuitem>
						</p:submenu>

						<p:submenu label="Sobre" icon="ui-icon-info">

							<p:menuitem value="SiGAA" onclick="diagSigaa.show()" />

							<p:menuitem value="FAQ" />
							<p:menuitem value="Ajuda" />

							<p:menuitem value="Contato" onclick="diagContato.show()" />

						</p:submenu>


					</p:menubar>


				</h:form>

			</p:layoutUnit>


			<p:layoutUnit id="bottom" position="south" size="55">
				<center>
					<h:outputText
						value="SiGAA - Sistema de Gerenciamento de Aceleração da Aprendizagem"
						style="font-size: 15px"></h:outputText>
					<br />
					<h:outputText value=" 2012-2013" style="font-size: 15px"></h:outputText>
				</center>
			</p:layoutUnit>

			<p:layoutUnit id="left" position="west" size="300" resizable="true"
				closable="true" collapsible="true" header="Menu" minSize="200">

				<h:form>
					<p:menu type="sliding" style="width:280px; height: 280px;"
						backLabel="voltar">
						<p:submenu label="Usuários" icon="ui-icon-person"
							rendered="#{sessao.usuario.categoria==0 || sessao.usuario.categoria==1}">
							<p:menuitem value="Novo Cadastro"
								actionListener="#{controladora.usuario}"
								update=":formC:pnlCorpo" icon="ui-icon-disk">
								<f:actionListener binding="#{actionPerfil.limpaBean}" />
							</p:menuitem>

							<p:menuitem value="Editar/Excluir"
								actionListener="#{controladora.editUsuario}"
								update=":formC:pnlCorpo" icon="ui-icon-pencil" />
						</p:submenu>
						<p:submenu label="Alunos" icon="ui-icon-person">
							<p:menuitem value="Novo Cadastro"
								rendered="#{sessao.usuario.categoria==0 || sessao.usuario.categoria==1}"
								actionListener="#{controladora.aluno}" update=":formC:pnlCorpo"
								icon="ui-icon-disk">
								<f:actionListener binding="#{actionAluno.limpaBean}" />
							</p:menuitem>
							<p:menuitem value="Editar/Excluir"
								actionListener="#{controladora.editAluno}"
								update=":formC:pnlCorpo" icon="ui-icon-pencil" />

						</p:submenu>
						<p:submenu label="Empresas" icon="ui-icon-home"
							rendered="#{sessao.usuario.categoria==0}">
							<p:menuitem value="Novo Cadastro"
								actionListener="#{controladora.empresa}"
								update=":formC:pnlCorpo" icon="ui-icon-disk">
								<f:actionListener binding="#{actionEmpresa.limpaBean}" />
							</p:menuitem>
							<p:menuitem value="Editar/Excluir"
								actionListener="#{controladora.editEmpresa}"
								update=":formC:pnlCorpo" icon="ui-icon-pencil" />
						</p:submenu>


						<p:separator />
						<p:menuitem value="Agenda" icon="ui-icon-calendar"
							actionListener="#{controladora.schedule}"
							update=":formC:pnlCorpo">
							<f:actionListener binding="#{actionAgenda.limpaCache}" />
						</p:menuitem>

						<p:menuitem value="Cards" icon="ui-icon-newwin"
							actionListener="#{controladora.card}" update=":formC:pnlCorpo">
						<f:actionListener binding="#{actionCard.instanciar}" />
						</p:menuitem>
						<p:submenu label="Categoria" icon="ui-icon-document-b">
							<p:menuitem value="Novo Cadastro"
								actionListener="#{controladora.categoria}"
								update=":formC:pnlCorpo" icon="ui-icon-disk">
								<f:actionListener binding="#{actionCategoria.limpaBean}" />
							</p:menuitem>
							<p:menuitem value="Editar/Excluir"
								actionListener="#{controladora.editCategoria}"
								update=":formC:pnlCorpo" icon="ui-icon-pencil">
								<f:actionListener binding="#{actionCategoria.instanciarS}" />
							</p:menuitem>
						</p:submenu>

						<p:menuitem value="Programas de ensino" icon="ui-icon-note"
							actionListener="#{controladora.programa}"
							update=":formC:pnlCorpo">
							<f:actionListener binding="#{actionPrograma.instanciarS}" />
						</p:menuitem>
						<p:menuitem value="Tarefas" icon="ui-icon-clipboard"
							actionListener="#{controladora.criaTarefa}"
							update=":formC:pnlCorpo">
							<f:actionListener binding="#{actionTarefa.instanciar}" />
						</p:menuitem>





					</p:menu>
				</h:form>

			</p:layoutUnit>

			<p:layoutUnit id="right" position="east" size="150" header="Opções"
				resizable="true" closable="true" collapsible="true"
				style="text-align:center">

				<h:form>

				</h:form>



				<p:commandButton id="basic" value="" icon="ui-icon-gear"
					onclick="dlg1.show();" type="button" style="margin-top:10px" />

			</p:layoutUnit>

			<p:layoutUnit id="center" position="center">




				<h:form id="formC">
					<p:growl id="growl" showDetail="true" life="4500" />
					<p:effect event="" type=""></p:effect>
					<p:outputPanel id="pnlCorpo" autoUpdate="true">
						<ui:insert name="corpo">
							<ui:include src="#{controladora.target}" />
						</ui:insert>
					</p:outputPanel>



				</h:form>









			</p:layoutUnit>

		</p:layout>

		<p:dialog header="Opções" widgetVar="dlg1" modal="true">
			<h:outputText value="Implementação futura" />
		</p:dialog>


		<p:ajaxStatus onstart="statusDialog1.show();" onerror="erro();"
			onsuccess="statusDialog1.hide();" />
			
			
			

		<p:dialog modal="true" widgetVar="statusDialog1"
			header="Carregando..." resizable="false" appendToBody="true"
			draggable="false" closable="false">
			<center>
				<p:graphicImage value="/imagens/ajax-loader.gif" />
			</center>
		</p:dialog>

		<p:dialog id="diagempres" header="Empresas" widgetVar="diagEmpz"
			modal="true" height="300" width="550" visible="true"
			rendered="#{sessao.usuario.categoria==0 and sessao.usuario.empresa.id==0}">
			<h:form>
				<center>
					<h3>Cadastre ou selecione um empresa do SiGAA para acessar as
						funcionalidades.</h3>
					<br /> <br />
					<h:panelGrid columns="2">
						<p:commandButton value="Selecionar empresa"
							actionListener="#{controladora.editEmpresa}"
							update=":formC:pnlCorpo" onsuccess="diagEmpz.hide();"></p:commandButton>
						<p:commandButton value="Cadastrar nova empresa"
							actionListener="#{controladora.empresa}" update=":formC:pnlCorpo"
							onsuccess="diagEmpz.hide();"></p:commandButton>
					</h:panelGrid>
				</center>
			</h:form>
		</p:dialog>


		<p:dialog id="diagsi" header="SiGAA" widgetVar="diagSigaa"
			modal="true" height="290" width="650">
			<p:graphicImage value="/imagens/sigaa_small.jpg" />
			<h:outputText
				value="Software desenvolvido para a criação, aplicação, gerenciamento e análise de tarefas educacionais voltadas para indivíduos com atraso no desenvolvimento." />
			<br />
			<br />
			<br />
			<h:outputText
				value="Projeto idealizado pelo Professor Dr. Márcio Borges Moreira e desenvolvido pelo Engenheiro Arthur Heleno L. R. de Souza  " />

		</p:dialog>

		<p:dialog id="diagsicont" header="Contato" widgetVar="diagContato"
			modal="true" height="280" width="500">
			<h:outputText
				value="CAMPUS EDSON MACHADO (ASA SUL) - Coordenação de Psicologia "
				style="font-weight:bold" />
			<br />
			<br />
			<h:outputText value="SGAS Quadra 613/614 – Lotes 97 e 98 Av. L2 Sul " />
			<br />
			<h:outputText value="Brasília - DF " />
			<br />
			<h:outputText value="CEP: 70.200-730" />
			<br />
			<br />
			<br />
			<h:outputText value="E-mail: sigaa@walden4.com.br" />




		</p:dialog>




	</h:body>

</f:view>
</html>